package com.lipl.base.javase.designpattern.factory.factorymethod;


/**
 * @Auther: 15541
 * @Date: 2020/10/24 10:45
 * @Description:
 */
public class TestFactoryMethod {

    public static void main(String[] args) {
        IFactory factoryA = new FactoryA();

        Product productA = factoryA.createProduct();
        System.out.println("productA name="+productA.getName()+",getPrice:"+productA.price());

        IFactory factoryB = new FactoryB();

        Product productB = factoryB.createProduct();
        System.out.println("productB name="+productB.getName()+",getPrice:"+productB.price());


        IFactory factoryC = new FactoryB();

        Product productC = factoryC.createProduct();

        System.out.println("productC name="+productC.getName()+",getPrice:"+productC.price());
    }
}

